import store from "@/store"
import {addActionCreator} from '@/store/action/counterAction'
import {useState} from 'react'
export default ()=>{
    const {count}=store.getState()
    const [,forceUpdate]=useState({})
    store.subscribe(()=>{
        forceUpdate({})
    })
    return (<>
        <h1>Redux的计数器</h1>
        <div>{count}</div>
        <button onClick={()=>{
            store.dispatch(addActionCreator(1))
        }}>+</button>
    </>)
}